package 工厂模式;

public class ShapeFactory {
    public ShapeFactory() {
    }

    public Shape getShape(Class shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (shapeType.getName().equals("Circle")) {
            return new Circle();
        } else if (shapeType.getTypeName().equals("Rectangle")) {
            return new Rectangle();
        } else if (shapeType.getTypeName().equals("Square")) {
            return new Square();
        } else {
            return null;
        }
    }
}
